export const useModelCreateFormData = <T>(formData: T, newFormData?: T) => {
  let key: keyof T;
  // 编辑时赋值
  if (newFormData) {
    for (key in formData) {
      formData[key] = newFormData[key]
    }
  }
  // 添加时赋值
  else {
    for (key in formData) {
      if (Object.prototype.toString.call(formData[key]) === '[object Array]') {
        formData[key] = <typeof formData[keyof T]> []
      }
      else if (Object.prototype.toString.call(formData[key]) === '[object Boolean]') {
        formData[key] = <typeof formData[keyof T]> false
      }
      else if (Object.prototype.toString.call(formData[key]) === '[object Number]') {
        formData[key] = <typeof formData[keyof T]> 0
      }
      else if (Object.prototype.toString.call(formData[key]) === '[object String]') {
        formData[key] = <typeof formData[keyof T]> ""
      }
    }
  }
}
